package sjtu;

import java.util.Scanner;

public class Sjtu1034 {
	public static void main(String[] args) {
		new Sjtu1034().go();
	}
	
	public void go(){
		
		Scanner scan = new Scanner(System.in);
		int n,k,temp,index;
		int[] arr,result;
		
		while(scan.hasNext()){
			index = 0;
			n = scan.nextInt();
			k = scan.nextInt();
			arr = new int[n];
			result = new int[n - k + 1];
			
			for(int i = 0;i < n;i ++){
				arr[i] = scan.nextInt();
			}
			for(int i = 0;i < n - k + 1;i ++){
				temp = 0;
				for (int j = 0; j < k; j++) {
					temp += arr[i + j];
				}
				result[index] = temp;
				index++;
			}
			for(int a : result){
				System.out.print(a+" ");
			}
			this.mergeSort(result, result.length);
			System.out.println(result[0]);
		}
	}
	
	public void mergeSort(int[] arr,int n){
		this.mergeSort(arr,0,n-1);
	}
	
	private void mergeSort(int[] arr,int l,int r){
		
		if(l >= r)return;
		
		int mid = (l + r)/2;
		this.mergeSort(arr,l,mid);
		this.mergeSort(arr,mid+1,r);
		if(arr[mid] > arr[mid + 1])
			this.merge(arr,l,mid,r);
	}
	
	private void merge(int[] arr,int l,int mid,int r){
		int[] temp = new int[r - l + 1];
		for(int i = l;i <= r; i++){
			temp[i - l] = arr[i];
		}
		
		int i = l,j = mid + 1;
		
		for(int k = l;k <=r;k ++){
			if(i > mid){
				arr[k] = temp[j - l];
				j++;
			}else if(j > r){
				arr[k] = temp[i - l];
				i++;
			}else if(temp[i - l] < temp[j -l]){
				arr[k] = temp[i-l];
				i ++;
			}else{
				arr[k] = temp[j - l];
				j ++;
			}
		}
	}
}
